let headers = {
	"Content-Type": "application/x-www-from-urlencoded",
	"Auth-Token": uni.getStorageSync('auth_token')
}

export let getFunc = (url, data) => {
	return new Promise((resolve, reject) => {
		uni.showLoading({
			title: "加载中",
			mask: true
		})
		uni.request({
			url: url,
			data: data,
			method: "GET",
			dataType: "json",
			success(res) {
				uni.hideLoading();
				resolve(res.data);
			},
			fail(err) {
				uni.hideLoading();
				reject(err)
			}
		})
	})
}

export let postFuc = (url, data) => {
	return new Promise((resolve, reject) => {
		uni.showLoading({
			title: "加载中",
			mask: true
		})
		uni.request({
			url: url,
			header: headers,
			data: data,
			method: "POST",
			dataType: "json",
			success(res) {
				uni.hideLoading();
				resolve(res);
			},
			fail(err) {
				uni.hideLoading();
				reject(err)
			}
		})
	})
}
